<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.fick.hibernate.model.*"%>
<%@ page import="com.fick.hibernate.dao.*"%>
<%@ page import="com.fick.util.Pager" %>
<%@ include file="../tld/tlds.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>通讯录管理</title>
<link href="images/jiahao.css" rel="stylesheet" type="text/css">

		<link href="css/css.css" rel="stylesheet" type="text/css" />
		<script language="JavaScript" src="js/meihuaxue.js"></script>
		<script language="javaScript" src="js/prototype.js"></script>
		<script type="text/javascript" src="js/submit.js"></script>
		
</head>

<body>
<%
	BaseHibernateDAO popDao=new BaseHibernateDAO();
	int currPage=1;
	int totalCount=0;
	int pageSize=10;
	int totalPage=1;
	if(request.getParameter("currPage")!=null && !request.getParameter("currPage").equals(""))
	{
		currPage=Integer.parseInt(request.getParameter("currPage"));		
	}
	totalCount=popDao.count(PopWindow.class,"");
	totalPage=totalCount%pageSize==0?totalCount/pageSize:(totalCount/pageSize)+1;
	List popList=popDao.getSession().createQuery("from PopWindow").setFirstResult((currPage-1)*pageSize).setMaxResults(pageSize).list();
%>
<table width="100%"  height="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="100%" align="center" valign="top" background="images/main_bj.gif" bgcolor="#FBFCFD"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="23" align="left" valign="middle" background="images/main_top.gif"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="20" height="23">&nbsp;</td>
            <td width="400" height="23" align="left" valign="middle" class="ts_lmdh2">弹出窗口管理 </td>
          </tr>
        </table></td>
      </tr>
    </table>
    <table width="98%" border="0" cellpadding="0" cellspacing="1" ><tr>
    <td height="20" align="left"><input type="button" value="添加弹出窗口" onclick="window.location.href='addPopwindow.jsp'"></td>
    </tr>
    </table>
      <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D7DFE1">
        <tr>
		 <td width="5%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">选择</td>
          <td width="15%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">标题</td>
		  <td width="15%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">url</td>          
          <td width="10%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">宽度</td>
          <td width="10%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">高度</td>
          <td width="15%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">开始时间</td>
          <td width="15%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">结束时间</td>
          <td width="15%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">操作</td>
        </tr>
       
	   <%
	   if(popList!=null)
	   {
		for(int i = 0 ; i < popList.size(); i++){
			PopWindow popWindow = (PopWindow)popList.get(i);
	 %>
	    <tr>
		<td width="5%" height="25" align="center" valign="middle" bgcolor="#FFFFFF">
		<input type="checkbox" name="MyCheckBox" id="MyCheckBox"
													value="<%=popWindow.getId()%>" />
		</td>
          <td width="15%" height="25" align="center" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <%=popWindow.getTitle()%>
		  </td>
		  <td width="15%" height="25" align="center" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <%=popWindow.getUrl()!=null&&popWindow.getUrl().length()>15?popWindow.getUrl().substring(0,15):popWindow.getUrl()%>
		  </td>
		  <td width="10%" height="25" align="center" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <%=popWindow.getWidth()%>
		  </td>
		  <td width="10%" height="25" align="center" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <%=popWindow.getHeight()%>
		  </td>
		  <td width="15%" height="25" align="center" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <%=popWindow.getBeginTime()%>
		  </td>
		  <td width="15%" height="25" align="center" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <%=popWindow.getEndTime()%>
		  </td>
  			<td width="15%" height="25" align="center" valign="middle" bgcolor="#FFFFFF">
			<a href="addPopwindow.jsp?id=<%=popWindow.getId()%>">修改</a>&nbsp;
			<a href="addPopwindow.jsp?del=true&id=<%=popWindow.getId()%>" onclick="javascript:return confirm('确定要删除吗删后将不可恢复')">删除</a>
			</td>
        </tr>
      <%
	  }
	  }
	  %>
	  </table>
	  
	  <table width="98%" align="center" border="0" cellspacing="0" cellpadding="0">
		  	<tr><td align="center"><%=new Pager().nprintTable("popWindowsList.jsp?",currPage,totalPage,totalCount,"","")%></td></tr>
	  </table>
      </td>
  </tr>
</table>
</body>
</html>
